<template>
  <u-popup
    class="padding"
    custom-style="width:90%"
    :safeAreaInsetBottom="true"
    :safeAreaInsetTop="true"
    :mode="popupData.mode"
    :show="showDetail"
    :round="popupData.round"
    :overlay="popupData.overlay"
    :closeable="popupData.closeable"
    :closeOnClickOverlay="popupData.closeOnClickOverlay"
    @close="close"
  >
    <view class="padding">
      <view class="padding-tb margin-top grid col-3">
        <view
          :class="{ hide: !langMap[key] }"
          class="flex-col text-df flex-center"
          v-for="(value, key) in info"
          :key="key"
        >
          <view class="margin-top text-grey">{{ langMap[key] }}</view>
          <!-- <u-tooltip class="text-cut w100 text-center text-bold" :text="value" :buttons="['复制']" bgColor="#e3e4e6"></u-tooltip> -->
          <view
            class="text-cut w100 text-center text-bold"
            @click="showInfoToast(value)"
          >
            {{ value || "--" }}
          </view>
        </view>
      </view>
      <u-button
        size="small"
        plain
        type="primary"
        :color="$u.color.primary"
        @click="gotoOrder"
        >查看订单</u-button
      >
      <u-button
        class="margin-top"
        size="small"
        plain
        type="primary"
        :color="$u.color.primary"
        @click="gotoPlan"
        >查看计划</u-button
      >
    </view>
  </u-popup>
</template>

<script>
const langMap = {
  // advertiser_id: "",
  // ad_user_id: "",
  // name: "",
  // cash: "",
  // on_put_num: "",
  // update_time: "",
  // cost: "",
  // sale: "",
  // effective_sale: "",
  // ROI: "",
  // effective_roi: "",
  // order_num: "",
  // convert_cost: "",
  // convert: "",
  // convert_rate: "",
  // click: "",
  // click_rate: "",
  // showDetail: "",
  // rsa_status: "",
  // account: "",
  // agent_account: "",
  // company_account: "",
  // pid_account: "",
  // oauth_state: "",
  // note: "",
  // open_refund_convert: "",
  // effective_order_num: "",
  // api_conversion_delay_time: "",
  // convert_refund_order: "",

  name: "户名",
  cash: "余额",
  on_put_num: "投放数",
  sale: "销售",
  effective_sale: "有效销售",
  roi: "roi",
  effective_roi: "有效roi",
  order_num: "订单数",
  effective_order_num: "有效订单数",
  convert: "转化数",
  pid_account: "成员",
};
import { toast } from "@/common/toast.js";

export default {
  props: {
    info: {
      type: Object,
      default() {
        return {};
      },
    },
    showDetail: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {
      langMap,
      popupData: {
        closeable: true,
        overlay: true,
        mode: "center",
        round: 10,
        closeOnClickOverlay: true,
      },
    };
  },
  methods: {
    showInfoToast(v) {
      toast({ title: v });
    },
    gotoOrder() {
      uni.navigateTo({
        url: "/pages/account/sub/order",
      });
    },
    gotoPlan() {
      uni.navigateTo({
        url: `/pages/account/sub/plan?ad_user_id=${this.info.ad_user_id}`,
      });
    },
    close() {
      this.$emit("update:showDetail", false);
    },
  },
};
</script>
<style lang="scss" scoped>
.login {
  width: 100%;
  background-image: url("~@/static/bg.png");
  background-repeat: no-repeat;
  background-size: cover;
}
</style>
